﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>添加机制会员</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../../CSS/bootstrap3.2/css/bootstrap.css" rel="stylesheet">
    <script src="../../Scripts/jquery-1.8.0.min.js"></script>
    <script src="../../Scripts/avalon.js"></script>
    <script type="text/javascript" src='../../JqueryPlug/lhgdialog/lhgdialog.js?skin=discuz'></script>
    <script src="../../Scripts/B2CCommon.js"></script>

    <script>
        $(document).ready(function () {
            var HYID = ComFunJS.getQueryString("id");
            $(".selJZHY").click(function () {
                MyDialog.btviewP('添加机制会员', 'url:Comon/CommonListN.aspx?FormCode=SCYH&ListType=SELECT&QType=allUser', '确认', function () {
                    var selids = this.content.getselids();
                    var selrowdata = this.content.getseldata();
                    $("#conJZHY").val(selrowdata[0].UserName).data('data', selrowdata)
                }, 820, 580, frameElement.api);
            })
            $(".selSJHY").click(function () {
                MyDialog.btviewP('添加上级机制会员', 'url:Comon/CommonListN.aspx?FormCode=SCYH&ListType=SELECT&QType=SJUser&SJType=' + HYID, '确认', function () {
                    var selids = this.content.getselids();
                    var selrowdata = this.content.getseldata();
                    $("#conSJHY").val(selrowdata[0].UserName).data('data', selrowdata)
                }, 820, 580, frameElement.api);
            })
            $("#addJZHY").click(function () {
                if ($("#conJZHY").val() == "") {
                    toastr.warning('请选择机制会员')
                } else if ($("#conJZHY").val() == $("#conSJHY").val()) {
                    toastr.warning('机制会员与上级机制会员不能相同')
                } else {
                    var SJHYID, SJHYUserName = "";
                    if ($("#conSJHY") != "") {
                        SJHYID = $("#conSJHY").data('data')[0].ID;
                        SJHYUserName = $("#conSJHY").data('data')[0].UserName;
                    }
                    $.post("DLLAjaxHandler.ashx", { Action: "SaveJZHY", HYID: $("#conJZHY").data('data')[0].ID, JZID: HYID, SJHYID: SJHYID, SJHYUserName: SJHYUserName }, function (data) {
                        if (data == "success") {
                            toastr.success("操作成功");
                        }
                    });
                }

            })
        })
    </script>
</head>
<body>
    <div class="container-fluid" style="margin-top: 20px">
        <div class="row">
            <div class="col-xs-6">
                <label>机制会员</label>
                <div class="input-group">
                    <input type="text" class="form-control" id="conJZHY" />
                    <span class="input-group-btn">
                        <a href="#" class="btn btn-info selJZHY">选择机制会员</a>
                    </span>
                </div>
                <div id="dvSJ">
                    <label style="margin-top: 20px">上级机制会员</label>
                    <div class="input-group">
                        <input type="text" class="form-control" id="conSJHY" />
                        <span class="input-group-btn">
                            <a href="#" class="btn btn-info selSJHY">选择机制会员上级</a>
                        </span>
                    </div>
                </div>
                <a href="#" class="btn btn-success" style="margin-top: 20px" id="addJZHY">确定添加</a>
            </div>
        </div>

    </div>
    <script src="../../JqueryPlug/Toast/toastr.js"></script>

</body>
</html>
